#!/bin/bash

APP_NAME=myapp
VENV_DIR=./venv


if [ -z "$VIRTUAL_ENV" ]
then if [ ! -d "$VENV_DIR" ]
     then echo "creating python3 virtualenv"
          python3 -m venv $VENV_DIR
     fi
     echo "activating python3 virtualenv"
     source $VENV_DIR/bin/activate
     [ -z "$VIRTUAL_ENV" ] && "failure activating python3 virtualenv" && exit
fi

if [ -d "$APP_NAME.egg-info" ]
then echo "python3 egg package already exists"
else echo "creating python3 egg package"
     pip3 install --editable .
     echo "installing dependencies"
     pip3 install git+https://github.com/behave/behave selenium
fi

export FLASK_APP=myapp
export FLASK_DEBUG=true
